from pymongo.results import UpdateResult
from lina.mongodb import db
from bson import ObjectId

from lina.service.BaseService import BaseService


class CommentService(BaseService):

    def __init__(self):
        self.table_name = 'case'
        super().__init__()

    def fetch_comments_by_case_id(self, case_id):
        # 查询一个案件的所有评论
        table = db()['comment']
        caseId = ObjectId(case_id)

        comment_list = []
        for comment in table.find({"case_id": caseId}):
            comment_list.append(comment)

        return comment_list

    def add(self, case_id, user_id, comment_id):
        # 发表或回复一条评论
        

        pass
